import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: XXHH
 * @CreateTime: 2025-05-05
 */
public class Demo43 {
    public static void main(String[] args) {
//        ExecutorService threadPool = Executors.newFixedThreadPool(5);
        ExecutorService threadPool = Executors.newCachedThreadPool();
        for (int i = 0; i <1000; i++) {
            int id = i;
            threadPool.submit(()->{
                System.out.println("Hello "+id+","+Thread.currentThread().getName());
            });
        }
        threadPool.shutdown();
    }
}
